<?php

namespace app\validate;

use app\Validate;

class Sms extends Validate
{
    /**
     * 所有验证场景需要的字段.
     *
     * @var array<array>
     */
    protected $scene = [
        'save' => ['mobile', 'code', 'action']
    ];
    /**
     * Get the validation rules that apply to the request.
     *
     * @var array<string>
     */
    protected $rule = [
        'id' => 'require|integer|max:10',
        'mobile' => 'requireWithout:id|regex:/^1[35789]\d{9}$/i',  // 手机号
        'action'  => 'requireWithout:id|max:20',  // 用途
    ];
    /**
     * 验证字段描述
     * 
     * @var array<string>
     */
    protected $field = [
        'mobile' => '手机号',
        'action' => '用途',
    ];
}
